<!DOCTYPE html>
<html lang="zh-cmn-Hans">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>APIDOC</title>
        <link rel="stylesheet" href="./style.css" />
        <link href="https://cdn.bootcss.com/prism/1.5.1/themes/prism.min.css" rel="stylesheet" />

        <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/handlebars.js/4.0.11/handlebars.min.js"></script>
        <script src="https://cdn.bootcss.com/prism/1.5.1/prism.min.js" data-manual></script>
        <script src="https://cdn.bootcss.com/prism/1.5.1/plugins/autoloader/prism-autoloader.min.js"></script>
    </head>
    <body>
        <div id="app"></div>

        <script id="page" type="text/x-handlebars-template">
            <aside>
                <header><h1>{{title}}</h1></header>

                <menu>
                    <ul class="menu">
                        <li class="menu-item content" data-path="content">home</li>
                        {{#each groups}}
                        <li class="menu-item api" data-path="{{this}}">{{@key}}</li>
                        {{/each}}
                    </ul>
                </menu>

                <footer>
                    <p>内容由<a href="{{appURL}}">{{appName}}</a>编译于 <time>{{dateFormat date}}</time>，用时{{elapsedFormat elapsed}}。</p>

                    {{#if licenseName}}
                    <p>内容采用<a href="{{licenseURL}}">{{licenseName}}</a>进行许可。</p>
                    {{/if}}
                </footer>
            </aside>

            <main id="main">{{{content}}}</main>
        </script>


        <script id="examples" type="text/x-handlebars-template">
            {{#each examples}}
            <pre><code class="language-{{type}}">{{code}}
            </code></pre>
            {{/each}}
        </script>

        <script id="params" type="text/x-handlebars-template">
            <table class="params">
                <thead>
                    <tr><th>名称</th><th>类型</th><th>描述</th></tr>
                </thead>
                <tbody>
                {{#each params}}
                <tr>
                    <th>{{name}}</th>
                    <td>{{type}}</td>
                    <td>{{summary}}</td>
                </tr>
                {{/each}}
                </tbody>
            </table>
        </script>

        <script id="headers" type="text/x-handlebars-template">
            <table>
                <thead>
                    <tr><th>名称</th><th>描述</th></tr>
                </thead>
                <tbody>
                {{#each headers}}
                <tr>
                    <th>{{@key}}</th>
                    <td>{{this}}</td>
                </tr>
                {{/each}}
                </tbody>
            </table>
        </script>

        <script id="response" type="text/x-handlebars-template">
        {{#if response.headers}}
            <h5>请求头</h5>
            {{> headers headers=response.headers}}
        {{/if}}

        {{#if response.params}}
            <h5>参数:</h5>
            {{> params params=response.params}}
        {{/if}}

        {{#if response.examples}}
            <h5>示例:</h5>
            {{> examples examples=response.examples}}
        {{/if}}
        </script>


        <script id="api" type="text/x-handlebars-template">
            <h2>{{name}}</h2>

            {{#each apis}}
            <section class="api">
                <h3>
                    <span class="method {{method}}">{{method}}</span>
                    <span class="url">{{url}}</span>
                    <span class="summary">{{summary}}</span>
                </h3>

                <div class="content">
                    {{#if description}}
                    <p class="description">{{description}}</p>
                    {{/if}}

                    {{#if queries}}
                        <h5>查询参数</h5>
                        {{> params params=queries}}
                    {{/if}}

                    {{#if params}}
                        <h5>参数</h5>
                        {{> params params=params}}
                    {{/if}}

                    {{#if request}}
                    <div class="request">
                        <h4>请求{{#if request.type}}:&#160;{{request.type}}{{/if}}</h4>
                        <div>
                            {{#if request.headers}}
                                <h5>报头:</h5>
                                {{> headers headers=request.headers}}
                            {{/if}}

                            {{#if request.params}}
                                <h5>参数:</h5>
                                {{> params params=request.params}}
                            {{/if}}

                            {{#if request.examples}}
                                <h5>示例:</h5>
                                {{> examples examples=request.examples}}
                            {{/if}}
                        </div>
                    </div>
                    {{/if}}

                    {{#if success}}
                    <div class="response success">
                        <h4><span class="success">SUCCESS:</span>{{success.code}},&#160;{{success.summary}}</h4>
                        {{> response response=success}}
                    </div>
                    {{/if}}

                    {{#if error}}
                    <div class="response error">
                        <h4><span class="error">ERROR:</span>{{error.code}},&#160;{{error.summary}}</h4>
                        {{> response response=error}}
                    </div>
                    {{/if}}
                </div>
            </section>
            {{/each}}
        </script>

        <script src="./app.js"></script>
    </body>
</html>
